package com.secondhand.project.service.impl;

import cn.hutool.core.date.DateUtil;
import com.secondhand.common.utils.SecurityUtils;
import com.secondhand.project.domain.Feedback;
import com.secondhand.project.mapper.FeedbackMapper;
import com.secondhand.project.service.IFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FeedbackServiceImpl implements IFeedbackService 
{
    @Autowired
    private FeedbackMapper feedbackMapper;

    @Override
    public Feedback selectFeedbackById(Long id)
    {
        return feedbackMapper.selectFeedbackById(id);
    }

    @Override
    public List<Feedback> selectFeedbackList(Feedback feedback)
    {
        return feedbackMapper.selectFeedbackList(feedback);
    }

    @Override
    public int insertFeedback(Feedback feedback)
    {
        feedback.setCreatetime(DateUtil.now());
        feedback.setUserId(SecurityUtils.getUserId());
        return feedbackMapper.insertFeedback(feedback);
    }

    @Override
    public int updateFeedback(Feedback feedback)
    {
        return feedbackMapper.updateFeedback(feedback);
    }

    @Override
    public int deleteFeedbackByIds(Long[] ids)
    {
        return feedbackMapper.deleteFeedbackByIds(ids);
    }

    @Override
    public int deleteFeedbackById(Long id)
    {
        return feedbackMapper.deleteFeedbackById(id);
    }
}
